package com.abcdefg.springioc;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.abcdefg.springioc.User;
import org.springframework.context.annotation.Primary;

@Configuration
public class BeanDemo {
   @Primary
    @Bean(name = {"user1","hahh"})
    public User user1(){
        User user=new User();
        user.setName("张三");
        user.setAge(18);
        return user;
    }

    @Bean(value = "user2")
    public User user2(){
        User user=new User();
        user.setName("lisi");
        user.setAge(20);
        return user;
    }
}
